package com.hsc.www.springCache.mapper;


import com.hsc.www.springCache.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {

    @Select("select * from user")
    List<User> getAll();

    @Select("select * from user where id=#{id}")
    User selectById(Integer id);

    @Update("update user set name=#{user.name},age=#{user.age},email=#{user.email} where id=#{user.id}")
    int updateById(@Param("user") User user);

    @Insert("insert into  user(id,name,age,email) values(#{user.id},#{user.name},#{user.age},#{user.email})")
    int insert(@Param("user") User user);

    @Insert("delete from user where id=#{id}")
    int deleteById(Integer id);
}
